<template>
    <div class="bankCard">
        <div class="wrapper">
            <div class="logo-left">
                <div class="left">
                    <img v-if="keyImg" v-bind:src="`/BankImg/${keyImg}.jpg`" alt="">
                    <img v-else src="/BankImg/NONE.jpg" alt="">
                </div>
                <div class="right">
                    <div>{{ bankInfo.bankName }}</div>
                    <div>借记卡</div>
                </div>
            </div>
            <div class="bankNo">
                **** **** **** {{ bankInfo.settleInfoBean.bankAccountNo }}
            </div>
        </div>
    </div>
</template>

<script setup name="bank">
import cards from "@/utils/banks.json"

// 使用 defineProps 声明 props
const props = defineProps({
    bankInfo: {
        type: Object,
        default: () => {
        }
    }
})
const keyImg = ref("")
for (let key in cards) {
    if (cards[key] === props.bankInfo.bankName) {
        keyImg.value = key
        break
    }
}
</script>

<style scoped lang="scss">
.wrapper {
    height: 127px;
    opacity: 1;
    background-image: url("@/assets/bankBg.png");
    background-size: 100% 100%;
    padding: 20px;
    position: relative;

    .logo-left {
        display: flex;
        align-items: center;
        font-size: 15px;
        font-weight: 400;
        color: #FFFFFF;
        opacity: 1;

        .left {
            width: 36px;
            height: 36px;
            margin-right: 10px;
            background: #FFFFFF;
            border-radius: 50%;
            opacity: 1;
            overflow: hidden;

            img {
                width: 100%;
                height: 100%;
                border-radius: 50%;
            }
        }
    }

    .default {
        width: 90px;
        text-align: center;
        background: #FFFFFF;
        opacity: 1;
        font-size: 11px;
        font-weight: 400;
        color: #0776E5;
        position: absolute;
        right: -30px;
        top: 10px;
        transform: rotate(45deg);
        opacity: 1;
    }

    .bankNo {
        font-size: 16px;
        font-weight: 400;
        color: #FFFFFF;
        opacity: 1;
        position: absolute;
        left: 10%;
        bottom: 20%;
    }

    .yl {
        font-size: 0;
        position: absolute;
        right: 0;
        bottom: 0;

        img {
            width: 96px;
            height: 77px;
        }
    }
}
</style>

